<template>
  <div class="app-container home">
    <div id="map" style="height: 100%"></div>
  </div>
</template>

<script>
import L from "leaflet";
import "leaflet/dist/leaflet.css";
import { baseMap } from "../../../utils/map";

export default {
  dicts: [],
  components: {},
  data() {
    return {
      map: null,
      tileLayer: null,
    };
  },
  mounted() {
    this.initMap();
    window.addEventListener("resize", this.handleResize);
  },
  beforeDestroy() {
    window.removeEventListener("resize", this.handleResize);
    this.map.remove();
  },
  methods: {
    initMap() {
      this.map = baseMap("map");
      this.handleResize();
    },
    handleResize() {
      if (this.map) {
        this.map.invalidateSize();
      }
    },
  },
};
</script>

<style lang="scss" scoped>
.home {
  padding: 0rem;
  width: 100%;
  height: calc(100vh - 84px);
}
.warning-headline {
  display: inline-flex;
  justify-content: flex-start;
  align-items: center;
  width: 100%;
  height: 1rem;
  margin-bottom: 0.4rem;
}
</style>
